$(document).ready(function () {
    const cs = new CookieSettings();

    let lstatus = cs.readCookie("loginstatus");

    let p = lstatus.indexOf("|");

    if (p < 0)
        window.location.href = "/login.html";
    else
        $("#loginusr")[0].innerText = lstatus.substring(2)

    $("#btnLogout").on("click", () => {
        cs.writeCookie("loginstatus", "", 2);
        window.top.location.href = "/login.html";
    })

    $("#btnUser").on("click", () => {
        $("#mainframe").attr("src", "/pages/users/users.html")
    })

    $("#btnEmp").on("click", () => {
        $("#mainframe").attr("src", "/pages/employees/employees.html")
    })

    $("#btnClass").on("click", () => {
        $("#mainframe").attr("src", "/pages/classes/classes.html")
    })

    $("#btnStudent").on("click", () => {
        $("#mainframe").attr("src", "/pages/students/students.html")
    })
});